<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<script src="${base}/js/crytojs/components/core.js"></script>
<script src="${base}/js/crytojs/components/md5.js"></script>
<script src="${base}/js/crytojs/components/evpkdf.js"></script>
<script src="${base}/js/crytojs/components/enc-base64.js"></script>
<script src="${base}/js/crytojs/components/cipher-core.js"></script>
<script src="${base}/js/crytojs/components/aes.js"></script>
<script src="${base}/js/crytojs/components/hmac.js"></script>
<script src="${base}/js/crytojs/components/sha1.js"></script>
<script src="${base}/js/crytojs/components/sha256.js"></script>




<script>
    var md5 = CryptoJS.MD5("Message").toString(CryptoJS.enc.Hex);
    console.log("md5 = %s", md5);

    var sHA1 = CryptoJS.SHA1("Message").toString(CryptoJS.enc.Hex);
    console.log("sHA1 = %s", sHA1);

    var sHA256 = CryptoJS.SHA256("Message").toString(CryptoJS.enc.Hex);
    console.log("sHA256 = %s", sHA256);

    var hmacMD5 = CryptoJS.HmacMD5("Message", "Secret Passphrase").toString(CryptoJS.enc.Hex);
    console.log("hmacMD5 = %s", hmacMD5);
    

    var hmacSHA1 = CryptoJS.HmacSHA1("Message", "Secret Passphrase").toString(CryptoJS.enc.Hex);
    console.log("hmacSHA1 = %s", hmacSHA1);
    

    // base64 encrypt
    var rawStr = "hello world!/+=";
    var wordArray = CryptoJS.enc.Utf8.parse(rawStr);
    var base64 = CryptoJS.enc.Base64.stringify(wordArray);
    console.log('base64Encrypt = ', base64);

    // base64 decrypt
    var parsedWordArray = CryptoJS.enc.Base64.parse(base64);
    var parsedStr = CryptoJS.enc.Utf8.stringify(parsedWordArray);
    console.log('base64Decrypt = ',parsedStr);
    
    
    
    // Hex encrypt   16进制加密
    var word2 ="中国hello world!/+=";
    var word2Array = CryptoJS.enc.Utf8.parse(word2);
    var encryptedHexStr = CryptoJS.enc.Hex.stringify(word2Array);
    console.log('CryptoJS.enc.Hex = ', encryptedHexStr);
    
    // Hex decrypt  16进制解密
    var hexWord2Array = CryptoJS.enc.Hex.parse(encryptedHexStr);
    var parsedStr = CryptoJS.enc.Utf8.stringify(hexWord2Array);;
    console.log('CryptoJS.Dec.Hex = ', parsedStr);

</script>    
</head>
<body>
 <h1>F12请看console</h1>
</body>
</html>